<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
</head>
<style>
 *{
  margin:0;
  padding:0;
  list-style-type: none;
 }
 
</style>
<script>
/*var infos=[ ['小A','女',21,'大一'],  ['小B','男',23,'大三'],

['小C','男',24,'大四'],  ['小D','女',21,'大一'],

['小E','女',22,'大四'],  ['小F','男',21,'大一'],

['小G','女',22,'大二'],  ['小H','女',20,'大三'],

['小I','女',20,'大一'],  ['小J','男',20,'大三']];

//第一次筛选，找出都是大一的信息
for(var i=0;i<10;i++){
     if(infos[i][1]=='女'&&infos[i][3]=='大一'){
         document.write(infos[i][0]);
     }
}*/
function count(){
     var a=parseInt(document.getElementById('txt1').value);
     console.log(a) ; 
    //获取第一个输入框的值
     var b=parseInt(document.getElementById('txt2').value);  
	//获取第二个输入框的值
	//获取选择框的值
	var f=document.getElementById('select').value;
	//获取通过下拉框来选择的值来改变加减乘除的运算法则
	var r;
	switch(f){
	    case '+':r=a+b;break;
	    case '-':r=a-b;break;
	    case '*':r=a*b;break;
	    case '/':r=a/b;break;
	}
  console.log(r);
    //设置结果输入框的值 
    var s=document.getElementById('fruit');
s.value=r;
   }
  </script> 
 </head> 
 <body>
   <input type='text' id='txt1' /> 
   <select id='select'>
		<option value='+'>+</option>
		<option value="-">-</option>
		<option value="*">*</option>
		<option value="/">/</option>
   </select>
   <input type='text' id='txt2' /> 
   <input type='button' value=' = ' /> <!--通过 = 按钮来调用创建的函数，得到结果--> 
   <input type='text' id='fruit'onclick="count()" />   
<body>
</html>                                                                                                                                 